package com.linwen.excise.niuke._40;

import java.util.*;

/**
 * @author wlw
 * @date 2023/3/6 11:07 PM
 */
public class _27查找兄弟单词 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        String[] str = new String[n];
        for (int i = 0; i < n; i++) {
            str[i] = scanner.next();
        }
        String x = scanner.next();
        int k = scanner.nextInt();

        List<String> list = new ArrayList<>();
        for (String s : str) {
            if(s.length()==x.length()&&!s.equals(x)){
                char[] sChars = s.toCharArray();
                char[] xChars = x.toCharArray();
                Arrays.sort(sChars);
                Arrays.sort(xChars);
                if(Arrays.toString(sChars).equals(Arrays.toString(xChars))){
                    list.add(s);
                }
            }
        }
        Collections.sort(list);
        System.out.println(list.size());
        if(list.size()>=k){
            System.out.println(list.get(k-1));
        }

    }
}
